import os
import sys
import configparser
import platform

def get_config(translator=None):
    """
    获取配置
    """
    config = configparser.ConfigParser()
    
    # Windows路径
    if not config.has_section('WindowsPaths'):
        config.add_section('WindowsPaths')
        
    config.set('WindowsPaths', 'storage_path', os.path.join(os.getenv("APPDATA"), "Cursor", "storage.json"))
    config.set('WindowsPaths', 'sqlite_path', os.path.join(os.getenv("APPDATA"), "Cursor", "Local Storage", "leveldb", "MANIFEST-000001"))
    config.set('WindowsPaths', 'machine_id_path', os.path.join(os.getenv("APPDATA"), "Cursor", "machineId"))
    config.set('WindowsPaths', 'cursor_path', os.path.join(os.getenv("LOCALAPPDATA", ""), "Programs", "Cursor", "resources", "app"))
    
    # macOS路径
    if not config.has_section('MacPaths'):
        config.add_section('MacPaths')
        
    config.set('MacPaths', 'storage_path', os.path.expanduser("~/Library/Application Support/Cursor/storage.json"))
    config.set('MacPaths', 'sqlite_path', os.path.expanduser("~/Library/Application Support/Cursor/Local Storage/leveldb/MANIFEST-000001"))
    config.set('MacPaths', 'machine_id_path', os.path.expanduser("~/Library/Application Support/Cursor/machineId"))
    config.set('MacPaths', 'cursor_path', "/Applications/Cursor.app/Contents/Resources/app")
    
    # Linux路径
    if not config.has_section('LinuxPaths'):
        config.add_section('LinuxPaths')
        
    config.set('LinuxPaths', 'storage_path', os.path.expanduser("~/.config/cursor/storage.json"))
    config.set('LinuxPaths', 'sqlite_path', os.path.expanduser("~/.config/cursor/Local Storage/leveldb/MANIFEST-000001"))
    config.set('LinuxPaths', 'machine_id_path', os.path.expanduser("~/.config/cursor/machineid"))
    config.set('LinuxPaths', 'cursor_path', "/opt/Cursor/resources/app")
    
    return config 